#include "hostdetail.h"
#include <QTableWidget>
#include <QSysInfo>
#include <QHeaderView>

void hostdetail::showSelfHostDetail(QTableWidget *tablewidget)
{
    //设置列数
    tablewidget->setColumnCount(2);

    //设置行数
    tablewidget->setRowCount(10);

    QStringList headerText;
    headerText<<"类别"<<"详细信息";
    tablewidget->setHorizontalHeaderLabels(headerText);
    tablewidget->verticalHeader()->setVisible(false);//不显示默认行号

    tablewidget->setItem(0,0,new QTableWidgetItem("架构信息"));
    tablewidget->setItem(0,1,new QTableWidgetItem(QSysInfo::buildAbi()));

    tablewidget->setItem(1,0,new QTableWidgetItem("内核类型"));
    tablewidget->setItem(1,1,new QTableWidgetItem(QSysInfo::kernelType()));

    tablewidget->setItem(2,0,new QTableWidgetItem("内核版本"));
    tablewidget->setItem(2,1,new QTableWidgetItem(QSysInfo::kernelVersion()));

    tablewidget->setItem(3,0,new QTableWidgetItem("机器主机名"));
    tablewidget->setItem(3,1,new QTableWidgetItem(QSysInfo::machineHostName()));

    tablewidget->setItem(4,0,new QTableWidgetItem("操作系统类型"));
    tablewidget->setItem(4,1,new QTableWidgetItem(QSysInfo::productType()));

    tablewidget->setItem(5,0,new QTableWidgetItem("操作系统名称"));
    tablewidget->setItem(5,1,new QTableWidgetItem(QSysInfo::prettyProductName()));

    tablewidget->setItem(6,0,new QTableWidgetItem("操作系统版本"));
    tablewidget->setItem(6,1,new QTableWidgetItem(QSysInfo::productVersion()));


    tablewidget->resizeColumnsToContents();//自动调整表格列宽
}
